"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var api_1 = require("../../../config/api");
var http_1 = require("@angular/http");
var BannerService = /** @class */ (function () {
    function BannerService(httpService) {
        this.httpService = httpService;
    }
    //获取活动列表
    BannerService.prototype.getActivityList = function (page, pageSize) {
        var url = api_1.tuikeSystemUrl + "/api/v1/admin/tuike_activity/activity_list?page=" + page + "&pageSize=" + pageSize;
        return this.httpService.httpGetAuth(url).map(function (res) { return res; });
    };
    //获取任务列表
    BannerService.prototype.getTaskList = function (page, pageSize) {
        var url = api_1.tuikeSystemUrl + "/api/v1/admin/Task/task_list?page=" + page + "&pageSize=" + pageSize + "&stage=1";
        return this.httpService.httpGetAuth(url).map(function (res) { return res; });
    };
    //活动详情
    BannerService.prototype.getActivityInfo = function (id) {
        var url = api_1.tuikeSystemUrl + "/api/v1/admin/tuike_activity/activity_info/" + id;
        return this.httpService.httpGetAuth(url).map(function (res) { return res; });
    };
    //新建活动
    BannerService.prototype.addActivity = function (data) {
        var url = api_1.tuikeSystemUrl + "/api/v1/admin/tuike_activity/add_activity";
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify(data);
        return this.httpService.httpPostAuth(url, body, options).map(function (res) { return res; });
    };
    //编辑活动
    BannerService.prototype.editActivity = function (data) {
        var url = api_1.tuikeSystemUrl + "/api/v1/admin/tuike_activity/edit_activity";
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify(data);
        return this.httpService.httpPostAuth(url, body, options).map(function (res) { return res; });
    };
    //删除活动
    BannerService.prototype.deleteActivity = function (data) {
        var url = api_1.tuikeSystemUrl + "/api/v1/admin/tuike_activity/delete_activity";
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify(data);
        return this.httpService.httpPostAuth(url, body, options).map(function (res) { return res; });
    };
    //改变活动状态
    BannerService.prototype.changeStatus = function (data) {
        var url = api_1.tuikeSystemUrl + "/api/v1/admin/tuike_activity/change_status";
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify(data);
        return this.httpService.httpPostAuth(url, body, options).map(function (res) { return res; });
    };
    BannerService = __decorate([
        core_1.Injectable()
    ], BannerService);
    return BannerService;
}());
exports.BannerService = BannerService;
